<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>echarts</title>
    <style>
      .chart-container {
        width: 800px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div class="chart-container"></div>
    <script src="./echarts.min.js"></script>
    <script>
      function randomData(num, min = 10, max = 100) {
        const data = [];
        for (let i = 0; i < num; i++) {
          data.push(Math.round(Math.random() * (max - min) + min));
        }
        return data;
      }

      const myEcharts = echarts.init(
        document.querySelector(".chart-container")
      );
      const option = {
        xAxis: {
          data: [
            "一月",
            "二月",
            "三月",
            "四月",
            "五月",
            "六月",
            "七月",
            "八月",
            "九月",
            "十月",
            "十一月",
            "十二月",
          ],
        },
        yAxis: {},
        series: [
          {
            type: "line",
            data: randomData(12),
          },
          {
            type: "bar",
            data: randomData(12),
          },
          {
            type: "pie",
            radius: [0, 40], // 半径
            center: [650, 50], // 圆心点坐标
            data: [
              {
                name: "x",
                value: 11,
              },
              {
                name: "y",
                value: 22,
              },
              {
                name: "z",
                value: 33,
              },
            ],
          },
        ],
        // color: ["green", "yellow"],
      };
      myEcharts.setOption(option);
    </script>
  </body>
</html>
